home *** CD-ROM | disk | FTP | other *** search
/ Delphi Developer's Kit 1996 / Delphi Developer's Kit 1996.iso / power / hintres / unit2.pas < prev    next >
Pascal/Delphi Source File  |  1995-12-22  |  1KB  |  56 lines

  1. unit Unit2;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     Button2: TButton;
  13.     Label1: TLabel;
  14.     Label2: TLabel;
  15.     procedure FormCreate(Sender: TObject);
  16.   private
  17.     { Private declarations }
  18.   public
  19.     { Public declarations }
  20.   end;
  21.  
  22. var
  23.   Form1: TForm1;
  24.  
  25. implementation
  26.  
  27. {$R *.DFM}
  28.  
  29. procedure LoadFormHints(aForm: TForm);
  30. var
  31.   i: Integer;
  32.   h: THandle;
  33.   resID: Longint;
  34.   resStr: array [0..255] of Char;
  35. begin
  36.   h := LoadLibrary('hintdll.dll');
  37.   for i := 0 to aForm.ComponentCount - 1 do begin
  38.     {Check for > 0 since some components may not have hints}
  39.     resID := aForm.Components[i].Tag;
  40.     if resID  > 0  then begin
  41.       LoadString(h, resID, resStr, SizeOf(resStr));
  42.       TControl(aForm.Components[i]).Hint := StrPas(resStr);
  43.     end;
  44.   end;
  45.   FreeLibrary(h);
  46. end;
  47.  
  48. procedure TForm1.FormCreate(Sender: TObject);
  49. begin
  50.   LoadFormHints(Self);
  51. end;
  52.  
  53. end.
  54.  
  55.  
  56.